<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center landlordCertification_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub landlordCertification_fd0_0'>
					<view class='flex flex-wrap align-center landlordCertification_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  landlordCertification_fd0_0_c0_c0'>&#xe6a7;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='landlordCertification_fd0_0_c1_c0'>房东认证</text>
					</view>
					<view class='flex flex-wrap align-center justify-end landlordCertification_fd0_0_c0'>
					</view>
				</view>
			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout landlordCertification_flex_1">
				<view class='flex flex-direction flex-wrap align-stretch landlordCertification_fd1_0'>
					<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c0'>
						<text class='landlordCertification_fd1_0_c0_c0'>姓名</text>
						<input class='landlordCertification_fd1_0_c0_c1' type="text" :placeholder="`请输入`"
							confirm-type="done" :maxlength="7" v-model="infoMessage.nickName"
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" />
					</view>
					<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c0'>
						<text class='landlordCertification_fd1_0_c0_c0'>联系电话</text>
						<input class='landlordCertification_fd1_0_c0_c1' type="number" :placeholder="`请输入`"
							confirm-type="done" :maxlength="11" v-model="infoMessage.phone"
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" />
					</view>
					<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c0'>
						<text class='landlordCertification_fd1_0_c0_c0'>身份证号</text>
						<input class='landlordCertification_fd1_0_c0_c1' type="idcard" :placeholder="`请输入`"
							confirm-type="done" :maxlength="18" v-model="infoMessage.shenfenzhenghao"
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" />
					</view>
					<view
						class='flex flex-direction flex-wrap align-stretch justify-between landlordCertification_fd1_0_c0'>
						<text class='landlordCertification_fd1_0_c3_c0'>身份证信息</text>
						<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c3_c1'>
							<view class='flex flex-direction flex-wrap align-center'>
								<view class="upload position-relative landlordCertification_fd1_0_c3_c1_c0_c0">
									<image class=" landlordCertification_fd1_0_c3_c1_c0_c0_image" mode="aspectFit"
										@tap="soloChooseImage(1)"
										:src="fd1_0_c3_c1_c0_c0 ? fd1_0_c3_c1_c0_c0 : STATIC_URL+'164.jpg'"></image>
								</view>
								<text>上传身份证 国徽面</text>
							</view>
							<view class='flex flex-direction flex-wrap align-center'>
								<image class='landlordCertification_fd1_0_c3_c1_c1_c0' mode="aspectFit"
									:src='STATIC_URL+"13.png"'></image>
								<text>示例</text>
							</view>
						</view>
						<view class='flex flex-wrap align-center justify-between'>
							<view class='flex flex-direction flex-wrap align-center'>
								<view class="upload position-relative landlordCertification_fd1_0_c3_c1_c0_c0">
									<image class=" landlordCertification_fd1_0_c3_c1_c0_c0_image" mode="aspectFit"
										@tap="soloChooseImage(2)"
										:src="fd1_0_c3_c2_c0_c0 ? fd1_0_c3_c2_c0_c0 : STATIC_URL+'164.jpg'"></image>
								</view>
								<text>上传身份证 人像面</text>
							</view>
							<view class='flex flex-direction flex-wrap align-center'>
								<image class='landlordCertification_fd1_0_c3_c1_c1_c0' mode="aspectFit"
									:src='STATIC_URL+"12.png"'></image>
								<text>示例</text>
							</view>
						</view>
					</view>
					<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c0'
						@tap.stop="pickerDiy1695694268255=true">
						<text class='landlordCertification_fd1_0_c0_c0'>所在城市</text>
						<input class='landlordCertification_fd1_0_c4_c1' type="text" :placeholder="`请选择`"
							confirm-type="done" :maxlength="18" :disabled='true'
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx"
							v-model="infoMessage.address" />
						<image class='landlordCertification_fd1_0_c4_c2' mode="aspectFit" :src='STATIC_URL+"14.png"'>
						</image>
					</view>
					<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c0'>
						<text class='landlordCertification_fd1_0_c0_c0'>现住址</text>
						<input class='landlordCertification_fd1_0_c0_c1' type="text" :placeholder="`请输入`"
							confirm-type="done" :maxlength="20" v-model="infoMessage.nowAddress"
							placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" />
					</view>
					<view class='flex flex-wrap align-center justify-between landlordCertification_fd1_0_c6' @tap.stop="chooseShequ">
						<text class='landlordCertification_fd1_0_c0_c0'>所属社区</text>
						<text class='landlordCertification_fd1_0_c6_c1'>{{shequValue?shequValue:'选择所属社区'}}</text>
					</view>
				</view>
				<button class='landlordCertification_fd1_1' @tap.stop="submitFunc()">提交</button>
			</view>
			<!---flex布局flex布局结束-->
			<!--选择器开始 -->
			<benben-picker ref="benbenWritePickerCodepicker2" :visible.sync="pickerDiy1695694268255"
				:label.sync='infoMessage.address' mode='region' :mask-show='true' :picker-height='88'
				:hide-area='false' @change="changeCityVal">
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between landlordCertification_picker2_0'>
						<text class='landlordCertification_picker2_0_c0'
							@tap="$refs.benbenWritePickerCodepicker2.cancel()">取消</text>
						<text class='landlordCertification_picker2_0_c1'>选择所在城市</text>
						<text class='landlordCertification_picker2_0_c2'
							@tap="$refs.benbenWritePickerCodepicker2.pickerConfirm()">确认</text>
					</view>
				</template>
			</benben-picker>
			<!--选择器结束 -->
			<!-- 所属社区 -->
			<benben-picker ref="benbenWritePickerCodepicker45" :visible.sync="pickerDiy1656985489961" :label.sync='shequValue'
				:value.sync='shequID' :options='regioNList' mode='selector' :mask-show='true' :timeout='true'
				:picker-height='88' default-type='value' :default-props='{"label":"street","value":"aid"}' @change="changeShequ">
				<template #picker-header>
					<view class='flex flex-wrap align-center justify-between landlordCertification_picker2_0'>
						<text class='landlordCertification_picker2_0_c0'
							@tap="$refs.benbenWritePickerCodepicker45.cancel()">取消</text>
						<text class='benbenWritePickerCodepicker45'>选择所属社区</text>
						<text class='benbenWritePickerCodepicker45'
							@tap="$refs.benbenWritePickerCodepicker45.pickerConfirm()">确认</text>
					</view>
				</template>
			</benben-picker>
		</view>
	</view>
</template>
<script>
	import UploadImage from '@/common/utils/upload-image.js'
	export default {
		components: {},


		data() {
			return {
				infoMessage: {
					nickName: '',
					phone: '',
					shenfenzhenghao: '',
					address: '',
					nowAddress: '',
					community: '',
					zhengmian: '',
					fanmian: ''
				},
				"pickerDiy1695694268255": false,
				"fd1_0_c3_c1_c0_c0": "",
				"fd1_0_c3_c1_c0_c0id": "",
				"fd1_0_c3_c2_c0_c0": "",
				"fd1_0_c3_c2_c0_c0id": "",
				"address": "",
				communitystreet_id:'',
				regioNList:[],
				shequValue:'',
				shequID:'',
				// shequType:[],
				pickerDiy1656985489961:false,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {

		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			changeShequ(e){
				this.shequID = e.value
			},
			chooseShequ(){
				if(!this.infoMessage.address){
					this.$message.info('请选择所在城市')
					return
				}
				this.pickerDiy1656985489961 = true
			},
			changeCityVal(e){
				let region = e.obj.area.label
				console.log(region);
				this.$api.post('/m6752/66f28ce74a3b2',{
					region:region
				}).then(res=>{
					if(res.data.code == 1){
						this.regioNList = res.data.data
						console.log(this.regioNList);
					}
				})
			},
			//上传单图、多图方法
			soloChooseImage(type) {
				let self = this
				// 从相册中选择图片
				uni.chooseImage({
					count: 1, // 默认3
					sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图，默认二者都有
					success: function(res) {
						self.uploading = true
						console.log(res,'res');
						// 开始上传
						new UploadImage(res.tempFiles, {
							complete: function(res) {
								console.log("1111", res);
								self.uploading = false
								if (type == 1) {
									self.fd1_0_c3_c1_c0_c0 = res[0].path;
									self.infoMessage.fanmian = res[0].id
								} else {
									self.infoMessage.zhengmian = res[0].id
									self.fd1_0_c3_c2_c0_c0 = res[0].path
								}
							},
						})
					},
				})
			},
			//提交认证
			submitFunc() {
				if(!this.infoMessage.phone){
					this.$message.info('请输入手机号')
					return
				}
				if(!this.infoMessage.nickName){
					this.$message.info('请输入姓名')
					return
				}
				if(!this.infoMessage.shenfenzhenghao){
					this.$message.info('请输入证件号码')
					return
				}
				let arr = {
					phone: this.infoMessage.phone,
					name: this.infoMessage.nickName,
					idcard_no: this.infoMessage.shenfenzhenghao,
					idcard_emblem:this.fd1_0_c3_c1_c0_c0, //国徽
					idcard_portrait:this.fd1_0_c3_c2_c0_c0, //人像
					communitystreet_id:this.communitystreet_id,
					address:this.infoMessage.nowAddress,
					communitystreet_id:this.shequID,
				}
				this.$api.post('/m6752/637c7d436e440', arr).then(res => {
					console.log(res)
					if (res.data.code == 1) {
						uni.showToast({
							title: res.data.msg,
						})
						this.$urouter.navigateTo(`/pages/grzx/process/process`);
					} else {
						uni.showToast({
							title: res.data.msg,
						})
					}
				})
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #F8F8F8;
		background-size: 100% auto;
	}

	.landlordCertification_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.landlordCertification_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
	}

	.landlordCertification_fd0_0_c0_c0 {
		font-size: 24rpx;
		color: rgba(21, 21, 21, 1);
	}

	.landlordCertification_fd0_0_c0 {
		width: 120rpx;
	}

	.landlordCertification_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.landlordCertification_flex_1 {
		padding: 24rpx 24rpx 24rpx 24rpx;
	}

	.landlordCertification_fd1_1 {
		background: #FC5F80;
		border-radius: 100rpx 100rpx 100rpx 100rpx;
		width: 638rpx;
		line-height: 88rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		font-weight: 500;
		margin: 0rpx 0rpx 48rpx 32rpx;
	}

	.landlordCertification_fd1_0_c6_c1 {
		color: var(--benbenFontColor1);
		font-size: 32rpx;
		font-weight: 400;
	}

	.landlordCertification_fd1_0_c6 {
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.landlordCertification_fd1_0_c4_c2 {
		width: 10rpx;
		height: 20rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 0rpx 16rpx;
	}

	.landlordCertification_fd1_0_c4_c1 {
		text-align: right;
		color: var(--benbenFontColor1);
		font-size: 32rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.landlordCertification_fd1_0_c3_c1_c1_c0 {
		width: 314rpx;
		height: 240rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.landlordCertification_fd1_0_c3_c1_c0_c0_image {
		width: 314rpx;
		height: 240rpx;
	}

	.landlordCertification_fd1_0_c3_c1_c0_c0 {
		width: 314rpx;
		height: 240rpx;
		margin: 0rpx 0rpx 24rpx 0rpx;
	}

	.landlordCertification_fd1_0_c3_c1 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.landlordCertification_fd1_0_c3_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.landlordCertification_fd1_0_c0_c1 {
		text-align: right;
		color: var(--benbenFontColor1);
		font-size: 32rpx;
	}

	.landlordCertification_fd1_0_c0_c0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 400;
	}

	.landlordCertification_fd1_0_c0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}

	.landlordCertification_fd1_0 {
		background: var(--benbenbgColor1);
		padding: 0rpx 23rpx 0rpx 25rpx;
		border-radius: 16rpx;
		background-size: 100% auto;
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.landlordCertification_picker2_0_c2 {
		color: rgba(252, 95, 128, 1);
		font-size: 32rpx;
		font-weight: 500;
		line-height: 40rpx;
	}

	.landlordCertification_picker2_0_c1 {
		color: #333333;
		font-size: 36rpx;
		font-weight: 500;
	}

	.landlordCertification_picker2_0_c0 {
		color: #BFBFBF;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 40rpx;
	}

	.landlordCertification_picker2_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
		border-radius: 25rpx 25rpx 0rpx 0rpx;
		background-size: 100% auto !important;
	}
</style>